
<extend name="Public/base" />
<block name="style">
    <style type="text/css">
        .form-item{border-bottom: 1px dashed #ccc;padding-top: 5px;padding-bottom: 5px;}
        .item-label{float: left;width: 130px;text-align: right;padding-right: 20px;color: #999;}
        .controls{float: left;}
        .btn{

    background: #09c;
}
.btn:hover{
    background: #09c;
}

         /* 头部Logo,主导航*/
            body{
                color:#000;
                font-family: '宋体';
                font-weight: 900;
            }
            .header {
                background-color:   #3697A0;
                height: 45px;
            }
            /* 主导航 */
            .main-nav a {
                height: 45px;
                color: #150303;
            }
            .main-nav a:hover {
                height: 45px;
                background-color:#70bcf3;
                color: #150303;
            }
            .main-nav .current{
                height: 45px;
                background-color: #70bcf3;
            }
            .main-nav .current a {
                height: 45px;
                background-color: #70bcf3;
                color: #150303;
            }
            .logo{
                height: 45px;
                background: #ccc;
            }
            .sidebar{
                margin-top:-5px;
                background:     #3697A0;
                color: #000;
                position: fixed;
                height: 110%;
                margin-top:-40px;
            }
            .subnav h3{
                color: #000;
            }

            .main-nav {
                /*width:100%;*/
                float: none;
                height: auto;
            }

            .mainnav {
                /*height: auto;*/
                height: 100%;
            }

            .main-nav li{
                float: none;
                width:180px;
            }
            .side-sub-menu > li > .item {
                color: #000;
                font-family: '宋体';
                font-size:15px;padding:0px;
                line-height: 25px;
            }
    </style>
</block>
<block name="body">
    <div class="main-title cf">
        <h2 style="padding-left: 10px;">订单详情</h2>
    </div>
    <!-- 标签页导航 -->
    <div class="tab-wrap" style="position:relative">
        <div class="tab-content">

            <php>
                $ptyh=D('Ptyh')->where(['uid'=>$info['uid']])->find();
                $trans=D('Trans')->where(['trade_no'=>$info['trade_no']])->find();
            </php>



                <div id="tab1" class="tab-pane in tab1">
                    <div class="form-item cf">
                        <label class="item-label">店铺名称：</label>
                        <div class="controls">
                            <span>{$ptyh.shop_name}</span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">店铺编号：</label>
                        <div class="controls">
                            <span>{$ptyh.yh_uid}</span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">平台订单号：</label>
                        <div class="controls">
                            <span>{$info.danhao}</span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">交易号： </label>
                        <div class="controls">
                            <span>{$info.trade_no}</span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">收款金额： </label>
                        <div class="controls">
                            <span>{$info.pay_money}</span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">收款账号： </label>
                        <div class="controls">
                           <span>{$info.seller}</span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">付款账号/付款ID：</label>
                        <div class="controls">
                            <span>{$info.buyer}/{$trans.buyer_id}</span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">收款时间：  </label>
                        <div class="controls">
                            <span>{$info.pay_time|date='Y-m-d H:i:s',###}</span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">收款状态：  </label>
                        <div class="controls">

                            <span><php>if($info['status']==0){echo "<font style='color:#FF3030'>交易失败</font>";}else{echo "交易成功";}</php></span>
                        </div>
                    </div>

                    <div class="form-item cf">
                        <label class="item-label">本次收益：  </label>
                        <div class="controls">
                            <span>{$info.yh_money}</span>
                        </div>
                    </div>
                    <notempty name="trans">
                        
                            <div class="form-item cf">
                                <label class="item-label">回款金额：  </label>
                                <div class="controls">
                                    <span><php>echo $trans['money'];</php></span>
                                </div>
                            </div>


                             <div class="form-item cf">
                                <label class="item-label">平台回款单号：</label>
                                <div class="controls">
                                    <span>{$trans.out_biz_no}</span>
                                </div>
                            </div>
                            <div class="form-item cf">
                                <label class="item-label">回款单号： </label>
                                <div class="controls">
                                    <span>{$trans.trade_num}</span>
                                </div>
                            </div>


                            <div class="form-item cf">
                                <label class="item-label">回款时间：  </label>
                                <div class="controls">
                                    <span>{$trans.time}</span>
                                </div>
                            </div>

                            

                            <div class="form-item cf">
                                <label class="item-label">回款状态：  </label>
                                <div class="controls">
                                    <span><php>if($trans['status']==0){echo "<font style='color:#FF3030'>交易失败</font>";}else{echo "交易成功";}</php></span>
                                </div>
                            </div>

                            


                        <if condition="$trans[status] eq 0">
                            <div class="form-item cf">
                                <label class="item-label">失败原因：  </label>
                                <div class="controls">
                                    <span>{$trans.cause}。可输入付款ID和回款金额单笔转账至客户。</span>
                                </div>
                            </div>

                            <div class="form-item cf">
                                <label class="item-label">付款ID：</label>
                                <div class="controls">
                                    <span>{$trans.buyer_id}</span>
                                    <input class="text pay_id"  value="{$trans.buyer_id}" type="hidden">
                                </div>
                            </div>
                            <div class="form-item cf">
                                <label class="item-label">回款金额：</label>
                                <div class="controls">
                                    <input class="text pay_money"  value="{$trans.money}" type="hidden">
                                    <span><php>echo $trans['money'];</php></span>
                                </div>
                            </div>
                            <input class="text trade_no"  value="{$trans.out_biz_no}" type="hidden">
                            <div class="form-item cf">
                                <label class="item-label"><button class="btn ">确认回款</button></label>
                               
                            </div>
                           
                            
                           
                            
                        </if>



                    </notempty>
                    




        </div>

    </div>
    
</block>
<block name="script">
    <script type="text/javascript" src="__STATIC__/jquery.dragsort-0.5.1.min.js"></script>
    <script type="text/javascript" charset="utf-8">


        Think.setValue("extend", {$info.extend|default=0});
            //导航高亮
            highlight_subnav('{:U('dingdan')}');




            $('.btn').click(function(){
                var user_id=$('.pay_id').val();
                var money  =$('.pay_money').val();
                var no     =$('.trade_no').val();
                // var ret=/^[w]/;
                // if(ret.test(str)){
                //     alert('ok');
                //   }else{
                //     alert('wrong');
                //   }
                $.ajax({
                    type:'post',
                    data:{'id':user_id,'money':money,'no':no},
                    url:"{:U('trans')}",
                    success:function(m){
                        confirm(m)
                        location.reload();
                    }
                })
            })

    </script>



</block>

